﻿<Window x:Class="TFSArtifactManager.MainWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
		xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
		xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
        xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
        x:Name="theMainWindow"
		Title="TFS Artifact Manager"
		Height="600"
		Width="900"
		WindowStartupLocation="CenterScreen"
        WindowState="Maximized"
		Icon="383.ico" Background="OldLace"
		DataContext="{Binding Main, Source={StaticResource Locator}}">
	
	<!-- See Skins/MainSkin.xaml for important details on how this view works (workspace / "mdi") etc. -->
	
	<Window.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="Skins/MainSkin.xaml" />
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
		<!--<Style x:Key="MenuItemStyle" TargetType="MenuItem">
			<Setter Property="HorizontalAlignment" Value="Stretch" />
		</Style>-->
	</Window.Resources>

    <extToolkit:BusyIndicator IsBusy="{Binding IsBusy, Mode=TwoWay}" BusyContent="{Binding BusyText, Mode=TwoWay}">
	    <DockPanel x:Name="uxDockRoot">

		    <StatusBar DockPanel.Dock="Bottom">
			    <StatusBarItem>
				    <StackPanel Orientation="Horizontal">
					    <TextBlock Text="Ready" />					
				    </StackPanel>
			    </StatusBarItem>
		    </StatusBar>
		
		    <Menu Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top" DockPanel.Dock="Top" Margin="0" Padding="0" Background="Transparent">
			    <MenuItem Header="File" HorizontalAlignment="Left">
				    <MenuItem Header="Settings" >
					    <i:Interaction.Triggers>
						    <i:EventTrigger EventName="Click">
							    <cmd:EventToCommand Command="{Binding SettingsCommand}" />
						    </i:EventTrigger>
					    </i:Interaction.Triggers>
				    </MenuItem>
				    <MenuItem Header="Exit" Click="ExitMenuItem_Click" />
			    </MenuItem>
			    <MenuItem Header="Changesets">
				    <MenuItem Header="Work Item Download" ToolTip="Download changesets for a given work item - i.e. single task">
					    <i:Interaction.Triggers>
						    <i:EventTrigger EventName="Click">
							    <cmd:EventToCommand Command="{Binding ChangesetDownloadCommand}" />
						    </i:EventTrigger>
					    </i:Interaction.Triggers>
				    </MenuItem>
				    <MenuItem Header="Work Item Mass Download (Project)" ToolTip="Mass download changesets - i.e. all work items linked to a project">
					    <i:Interaction.Triggers>
						    <i:EventTrigger EventName="Click">
							    <cmd:EventToCommand Command="{Binding MassDownloadCommand}" />
						    </i:EventTrigger>
					    </i:Interaction.Triggers>
				    </MenuItem>
			    </MenuItem>
			    <MenuItem Header="Database">
				    <MenuItem Header="Database Packager" ToolTip="Choose, order and package database scripts for deployment">
					    <i:Interaction.Triggers>
						    <i:EventTrigger EventName="Click">
                                <cmd:EventToCommand Command="{Binding DatabasePackagerCommand}" />
						    </i:EventTrigger>
					    </i:Interaction.Triggers>
				    </MenuItem>
			    </MenuItem>
		    </Menu>                
        
		    <HeaderedContentControl DockPanel.Dock="Top"
		      Content="{Binding Path=Workspaces}"
		      ContentTemplate="{StaticResource WorkspacesTemplate}"
		      Header="Choose your destiny"
		      Style="{StaticResource MainHCCStyle}">
			    <HeaderedContentControl.HeaderTemplate>
				    <DataTemplate>
                        <Border BorderBrush="LightGray" BorderThickness="1" CornerRadius="5" Margin="1" Padding="2" SnapsToDevicePixels="True" 
                                Background="SeaGreen" 
							    >

                            <StackPanel Orientation="Horizontal">

                                <Button Content="Work Item" Width="100" Cursor="Hand" Margin="0,0,5,0" BorderThickness="1"
                                    Command="{Binding DataContext.ChangesetDownloadCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DockPanel}}" />
                                <Button Content="Mass Download" Width="100" Cursor="Hand"  Margin="0,0,5,0"
                                    Command="{Binding DataContext.MassDownloadCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DockPanel}}"/>
                                <Button Content="DB Packager" Width="100"  Cursor="Hand" 
                                    Command="{Binding DataContext.DatabasePackagerCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DockPanel}}"/>
                            </StackPanel>
                        </Border>
                    </DataTemplate>
			    </HeaderedContentControl.HeaderTemplate>
		    </HeaderedContentControl>
        
	    </DockPanel>
    </extToolkit:BusyIndicator>
</Window>
